package day2.demo1.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MyCtrl {
    @RequestMapping("/hello")
    public void h(){
        System.out.println("this is hello");
//        默认会访问web-inf/view/找hello.html
    }
    @RequestMapping("/s")
    public String h2(){
        System.out.println("this is s");
        return "hello";
    }

    @RequestMapping("/a")
    public String h3(){
        System.out.println("this is s");
//        重定向
        return "redirect:/html/a.html";
    }

    @RequestMapping("/b")
    @ResponseBody
    public String h4(){
        return "123";
    }

}
